home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
batuti.arc
/
SETCDR.C
< prev
next >
Wrap
Text File
|
1990-01-11
|
946b
|
45 lines
/*
*
* setcdr -- sets the environment variable name in arg[1] to the current
* drive specifier.
* Richard Connelly,(C) 1989,1990
*
*/
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
#include <dir.h>
#include <mem.h>
#include <string.h>
#include "mst_env.h"
#define buflen 256
void main(int argc, char *argv[])
{
/*
* Determine if the user is using the command correctly
*/
char buf[buflen];
if (argc == 1)
{
fprintf(stderr," usage:\n\t setcdr env-name \n");
exit(-1);
}
/*
* Set the current drive spec. to an environment variable provided via argv
*/
/* set the environment var passed */
strcpy(buf," :");
buf[0]=getdisk()+'A';
if (m_putenv(argv[1],buf))
fprintf(stderr,"Out of environment space\n");
exit(0); /* by argv & terminate successfully */
}